<div class="main-content">
    <div class="container">
        <div class="row">
            <div class="col-sm-12">
                <ol class="breadcrumb">
                    <li>
                        <i class="clip-file"></i>
                        <a href="#">
                            Logística
                        </a>
                    </li>
                    <li class="active">
                        Productos
                    </li>					
                </ol>
                <div class="page-header">
                    <h1>Productos <small>Listado</small></h1>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-12">
                <!-- start: DYNAMIC TABLE PANEL -->
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <i class="icon-external-link-sign"></i>
                        Productos
                        <div class="panel-tools">
                            <a class="btn btn-xs btn-link panel-collapse collapses" href="#">
                            </a>
                            <a class="btn btn-xs btn-link panel-config" href="#panel-config" data-toggle="modal">
                                <i class="icon-wrench"></i>
                            </a>
                            <a class="btn btn-xs btn-link panel-refresh" href="#">
                                <i class="icon-refresh"></i>
                            </a>
                            <a class="btn btn-xs btn-link panel-expand" href="#">
                                <i class="icon-resize-full"></i>
                            </a>
                            <!--<a class="btn btn-xs btn-link panel-close" href="#">
                                <i class="icon-remove"></i>
                            </a> -->
                        </div>
                    </div>
                    <div class="panel-body">
                        <form action="<?php echo base_url('logistica/proceso/productos'); ?>" class="form-horizontal" method="POST">
                            <div class="row">
                                <div class="col-md-5">
                                    <div class="form-group">
                                        <label for="linea" class="col-sm-2 control-label">Línea</label>
                                        <div class="col-sm-9">
                                            <!--<select id="linea" name="linea" class="form-control search-select">
                                                <option></option>
                                            </select> -->
                                            <?php
                                            $css = 'class="form-control search-select" id="linea" placeholder="Seleccione Linea"';
                                            echo form_dropdown("linea", $lineas, $this->form_data->linea, $css);
                                            ?>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-5">
                                    <div class="form-group">
                                        <label for="familia" class="col-sm-2 control-label">Familia</label>
                                        <div class="col-sm-9">
                                           <!-- <select id="familia" name="familia" class="form-control search-select">
                                                <option></option>
                                            </select> -->
                                            <?php
                                            $prop = 'class="form-control search-select" id="familia" placeholder="Seleccione Familia"';
                                            echo form_dropdown("familia", $familias, $this->form_data->familia, $prop);
                                            ?>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-2">
                                    <div class="form-group">
                                        <div class="col-sm-4">
                                            <button type="submit" id="busProd" style="margin-top: 3px" class="btn btn-primary "><i class="icon-search"></i></button>
                                        </div>  
                                    </div>  
                                </div>
                            </div>
                        </form>
                        <hr>

                        <table class="table table-striped table-bordered table-condensed table-hover table-full-width" id="sample_1">
                            <thead>
                                <tr>
                                    <th class="hidden">Id</th>
                                    <th>Producto</th>
                                    <th>Modelo</th>
                                    <th>Marca</th>
                                    <th>Acciones</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                if (!empty($productos)) :
                                    foreach ($productos as $fila):
                                        ?>
                                        <tr class="desmarcado" style="cursor: pointer;" >               
                                            <td class="hidden"><?php echo $fila->id_prod; ?></td>
                                            <td><?php echo $fila->desc_prod; ?></td>  
                                            <td><?php echo $fila->modelo; ?></td>
                                            <td><?php echo $fila->desc_marca; ?></td>
                                            <td class="center">
                                                <div class='visible-md visible-lg hidden-sm hidden-xs'>
                                                    <a class='btn btn-teal tooltips panel-config' data-toggle='modal' href="<?= base_url("logistica/proceso/formProducto/$fila->id_prod"); ?>">
                                                        <i class='icon-edit'></i>
                                                    </a>
                                                    <a class='btn btn-green tooltips panel-config' data-toggle='modal' href="<?= base_url("logistica/proceso/frmStock/$fila->id_prod"); ?>">
                                                        <i class='icon-edit'></i>
                                                    </a>                                                    
                                                </div>
                                                <div class="visible-xs visible-sm hidden-md hidden-lg">
                                                    <div class="btn-group">
                                                        <a class="btn btn-primary dropdown-toggle btn-sm" data-toggle="dropdown" href="#">
                                                            <i class="icon-cog"></i> <span class="caret"></span>
                                                        </a>
                                                        <ul role="menu" class="dropdown-menu pull-right">
                                                            <li role="presentation">
                                                                <a role="menuitem" tabindex="-1" href="#">
                                                                    <i class="icon-edit"></i> Editar
                                                                </a>
                                                                <a role="menuitem" tabindex="-1" href="#">
                                                                    <i class="icon-edit"></i> Stock
                                                                </a>
                                                            </li>
                                                        </ul>
                                                    </div>                                                   
                                                </div>
                                            </td>
                                        </tr>
                                        <?php
                                    endforeach;
                                endif;
                                ?>       					
                            </tbody>
                        </table>

                    </div>
                </div>
                <!-- end: DYNAMIC TABLE PANEL -->
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    $(function() {
        $("#linea").change(function() {
            $("#familia option").remove();
            var linea = $("#linea").val();
            if (linea > 0) {
                combo("<?php echo base_url("logistica/proceso/combo/familia") ?>/" + linea, "familia");
            }
        });
    });
</script>